<?php
/* --------------------------------
 *  Каркас Сайта
 * 
 * 11 июня 2012
 * © Deemon 
 --------------------------------*/

$view->css('main');
$view->js('site/jquery.easing.1.3.min');

if( $view->templ == 'sub_category' && !$view->is_category )
    $view->js('site/jquery.ui-slider');  // Цены в фильтре товаров

if( $view->templ == '_main' )
    $view->js('site/jquery.ad-gallery.min');

$view->js('store');
$view->js('site/placeholder');
$view->js('site/jquery.sliderkit.1.9.2.pack');
$view->js('site/jquery.ui.totop');
$view->js('site/javascript');
$view->js('site/jquery.mousewheel');
$view->js('site/jquery.core-ui-select');
$view->js('site/jquery.cookie');
$view->js('site/fancybox/jquery.fancybox-1.2.1.pack');
$view->js('site/fancybox/script');
$view->js('site/jquery.CarouselLifeExample');

// $view->js('site/swfobject');
// $view->js('site/jwplayer');

/*if( isset($user->id) && $user->id == 3145 && isset($_SERVER['HTTP_REFERER']) ){
    echo $_SERVER['HTTP_REFERER'];
}*/

$authorisation = ''; //  $load->block('authorisation');
$store_basket = $load->block('store_basket');

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <link href="/inc/images/bg/favicon.png" rel="shortcut icon" />
    <link rel="stylesheet" href="/inc/src/js/site/fancybox/jquery.fancybox.css" media="all"/>


    <!-- Google analytics -->
    <script type="text/javascript">
        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-43645417-1']);
        var OpenStatParser = {
            _params: {},
            _parsed: false,
            _decode64: function(data) {
                if (typeof window['atob'] === 'function') {
                    return atob(data);
                }

                var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
                var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
                    ac = 0,
                    dec = "",
                    tmp_arr = [];

                if (!data) {
                    return data;
                }

                data += '';

                do {
                    h1 = b64.indexOf(data.charAt(i++));
                    h2 = b64.indexOf(data.charAt(i++));
                    h3 = b64.indexOf(data.charAt(i++));
                    h4 = b64.indexOf(data.charAt(i++));

                    bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;

                    o1 = bits >> 16 & 0xff;
                    o2 = bits >> 8 & 0xff;
                    o3 = bits & 0xff;

                    if (h3 == 64) {
                        tmp_arr[ac++] = String.fromCharCode(o1);
                    } else if (h4 == 64) {
                        tmp_arr[ac++] = String.fromCharCode(o1, o2);
                    } else {
                        tmp_arr[ac++] = String.fromCharCode(o1, o2, o3);
                    }
                } while (i < data.length);

                dec = tmp_arr.join('');

                return dec;
            },
            _parse: function() {
                var prmstr = window.location.search.substr(1);
                var prmarr = prmstr.split('&');
                this._params = {};

                for (var i = 0; i < prmarr.length; i++) {
                    var tmparr = prmarr[i].split('=');
                    this._params[tmparr[0]] = tmparr[1];
                }

                this._parsed = true;
            },
            hasMarker: function() {
                if (!this._parsed) {
                    this._parse();
                }
                return (typeof this._params['_openstat'] !== 'undefined') ? true : false;
            },
            buildCampaignParams: function() {
                if (!this.hasMarker()) {
                    return false;
                }
                var openstat = this._decode64(this._params['_openstat']);
                var statarr = openstat.split(';');
                return 'utm_campaign=' + statarr[3] + '&utm_source=' + statarr[0] + '&utm_medium=cpc&utm_content=' + statarr[2];
            }
        }
        if (OpenStatParser.hasMarker()) {
            var campaignParams = OpenStatParser.buildCampaignParams();
            if (campaignParams !== false) {
                _gaq.push(['_set', 'campaignParams', campaignParams]);
            }
        }
        _gaq.push(['_addOrganic', 'images.yandex.ru', 'text']);
        _gaq.push(['_addOrganic', 'blogs.yandex.ru', 'text']);
        _gaq.push(['_addOrganic', 'video.yandex.ru', 'text']);
        _gaq.push(['_addOrganic', 'yandex.ru', 'text']);
        _gaq.push(['_addOrganic', 'yandex.ru', 'query']);
        _gaq.push(['_addOrganic', 'images.yandex.ua', 'text']);
        _gaq.push(['_addOrganic', 'blogs.yandex.ua', 'text']);
        _gaq.push(['_addOrganic', 'video.yandex.ua', 'text']);
        _gaq.push(['_addOrganic', 'yandex.ua', 'text']);
        _gaq.push(['_addOrganic', 'yandex.ua', 'query']);
        _gaq.push(['_addOrganic', 'images.yandex', 'text']);
        _gaq.push(['_addOrganic', 'blogs.yandex', 'text']);
        _gaq.push(['_addOrganic', 'video.yandex', 'text']);
        _gaq.push(['_addOrganic', 'yandex', 'text']);
        _gaq.push(['_addOrganic', 'yandex', 'query']);
        _gaq.push(['_addOrganic', 'go.mail.ru', 'q']);
        _gaq.push(['_addOrganic', 'mail.ru', 'q']);
        _gaq.push(['_addOrganic', 'images.google.ru', 'q']);
        _gaq.push(['_addOrganic', 'maps.google.ru', 'q']);
        _gaq.push(['_addOrganic', 'google.com.ua', 'q']);
        _gaq.push(['_addOrganic', 'rambler.ru', 'words']);
        _gaq.push(['_addOrganic', 'nova.rambler.ru', 'query']);
        _gaq.push(['_addOrganic', 'nova.rambler.ru', 'words']);
        _gaq.push(['_addOrganic', 'gogo.ru', 'q']);
        _gaq.push(['_addOrganic', 'nigma.ru', 's']);
        _gaq.push(['_addOrganic', 'search.qip.ru', 'query']);
        _gaq.push(['_addOrganic', 'webalta.ru', 'q']);
        _gaq.push(['_addOrganic', 'sm.aport.ru', 'r']);
        _gaq.push(['_addOrganic', 'meta.ua', 'q']);
        _gaq.push(['_addOrganic', 'search.bigmir.net', 'z']);
        _gaq.push(['_addOrganic', 'search.i.ua', 'q']);
        _gaq.push(['_addOrganic', 'index.online.ua', 'q']);
        _gaq.push(['_addOrganic', 'web20.a.ua', 'query']);
        _gaq.push(['_addOrganic', 'search.ukr.net', 'q']);
        _gaq.push(['_addOrganic', 'search.ukr.net', 'search_query']);
        _gaq.push(['_addOrganic', 'search.com.ua', 'q']);
        _gaq.push(['_addOrganic', 'search.ua', 'q']);
        _gaq.push(['_addOrganic', 'poisk.ru', 'text']);
        _gaq.push(['_addOrganic', 'go.km.ru', 'sq']);
        _gaq.push(['_addOrganic', 'liveinternet.ru', 'ask']);
        _gaq.push(['_addOrganic', 'gde.ru', 'keywords']);
        _gaq.push(['_addOrganic', 'affiliates.quintura.com', 'request']);
        _gaq.push(['_addOrganic', 'akavita.by', 'z']);
        _gaq.push(['_addOrganic', 'search.tut.by', 'query']);
        _gaq.push(['_addOrganic', 'all.by', 'query']);
        _gaq.push(['_trackPageview']);

        (function() {
            var ga = document.createElement('script');
            ga.type = 'text/javascript';
            ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
            var s = document.getElementsByTagName('script')[0];
            s.parentNode.insertBefore(ga, s);
        })();

        window.onload = function() {
            if(_gaq.I==undefined){
                _gaq.push(['_trackEvent', 'tracking_script', 'loaded', 'ga.js', ,true]);
                ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
                ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
                s = document.getElementsByTagName('script')[0];
                gaScript = s.parentNode.insertBefore(ga, s);
            } else {
                _gaq.push(['_trackEvent', 'tracking_script', 'loaded', 'dc.js', ,true]);
            }
        };
    </script>
    <!-- Google Analytics end -->

    <?php $view->printHead(); ?>
    <!--[if IE]><link href="/inc/css/ie.css" rel="stylesheet" type="text/css" media="all" /><![endif]-->
    <!--[if IE 9]><link href="/inc/css/ie9.css" rel="stylesheet" type="text/css" media="all" /><![endif]-->
    <!-- Google and Yandex web-masters. No Delete-->
    <meta name='yandex-verification' content='724ae2bbaeaa4bff' />
    <meta name="google-site-verification" content="jKPxLH1IFph7xQQoX58f-sPwp_ZoPjsAMDPb92SMUXk" />
    <!-- End Google and Yandex web-masters. No Delete-->

</head>
<body>
<?=$store_basket?>

<div class="wrapper">

    <div class="header">

        <?=( $view->templ != 'order' ) ? $load->block('menu_top') : '' ?>		<!-- Верхнее меню -->
        <div class="middle-panel centering">
            <div class="middle-panel__inner">
                <div class="logo">
                    <a href="/" class="logo__inner">
                        <span>RayBT</span>
                    </a>
                </div>
                <ul class="user-panel">
                    <!--<li class="user-panel__item login">
							<?$authorisation?>
						</li>-->
                    <li class="user-panel__item your-shopping-cart">
                        <a href="http://clck.yandex.ru/redir/dtype=stred/pid=47/cid=2508/*http://market.yandex.ru/shop/60726/reviews"><img src="http://clck.yandex.ru/redir/dtype=stred/pid=47/cid=2507/*http://grade.market.yandex.ru/?id=60726&action=image&size=2" border="0" width="150" height="101" alt="Читайте отзывы покупателей и оценивайте качество магазина на Яндекс.Маркете" /></a>
                        <div class="shopping-cart"></div>						<!-- Содержимое корзины -->
                    </li>
                </ul>
                <?=$load->block('main_search')?>								<!-- Поле для поиска -->
            </div>
        </div>

        <?=$load->block('support_service')?>									<!-- Телефоны, Скайп, Онлайн консультант и Обратная связь -->

        <?=( $view->templ != 'order' ) ? $load->block('navi_top') : '' ?>		<!-- Каталог категорий -->
    </div>

    <?=( $view->templ == '_main') ? $load->block('slider_top') : '' ?>			<!-- Верхний слайдер слайдер -->
    <?php ( ( $view->templ == '_main') ? ivan_baner( 'top' ) : '' )?>			<!-- Верхний слайдер слайдер -->


    <div class="page">
        <div class="page__inner <?=(($view->templ == '_main')?'':'centering')?>">

            <?=( $view->templ != '_main' && $view->templ != 'product' && $view->templ != 'ny_promo' && $view->templ != '_404' && $view->templ != 'order' && $view->templ != 'comparison' && $view->templ != 'unsubscription' && $view->templ != 'definition_accessories' ) ? '<div class="article">'.$load->block('crumbs').$view->gText.'</div>' : '' ?>	<!-- Контентная часть -->

            <?=( $view->templ == 'ny_promo' || $view->templ == 'definition_accessories' ) ? $view->gText : '' ?>

            <?=( $view->templ == 'product' || $view->templ == 'comparison' && $view->templ != 'ny_promo' ) ? $load->block('crumbs').$view->gText : '' ?>			<!-- Контентная часть -->

            <?=( $view->templ == '_404' || $view->templ == 'order' || $view->templ == 'unsubscription' ) ? $view->gText : '' ?>			<!-- Контентная часть -->

            <?=( $view->templ == '_main') ? $load->block('navi_main').'<hr />'.$load->block('news_hits_sales_product_list').$load->block('slider_bottom').$load->block('centering') : ''?>

            <? if( $view->templ == '_simple' || $view->templ == 'video_page' || $view->templ == 'news-list' || $this->view->url_before == '/news' || $view->templ == 'article-list' || $this->view->url_before == '/stati' || $view->templ == 'akcii-list' || $this->view->url_before == '/akcii' || $this->view->templ == '_search' || $view->templ == 'sub_category' || $view->templ == 'category' ||  $view->templ == 'contact' ||  $view->templ == 'brand' ):?>
                <div class="sidebar">
                    <?=( $view->templ == '_simple' || $view->templ == 'news-list' || $this->view->url_before == '/news' || $view->templ == 'article-list' || $this->view->url_before == '/stati' || $view->templ == 'akcii-list' || $this->view->url_before == '/akcii' || $this->view->templ == '_search' ||  $view->templ == 'contact' ) ? $load->block('menu_left').$load->block('order_call_manager') : '' ?>			<!-- Левое меню  -->

                    <?=( $view->templ == 'sub_category' || $view->templ == 'category' ||  $view->templ == 'brand' ) ? $load->block('store_product_filter').$load->block('order_call_manager') : '' ?>
                    <?=( $view->templ == 'video_page' ) ? $load->block('video_menu_left').$load->block('order_call_manager') : '' ?>
                    <?=( $view->templ == '_simple' || $view->templ == 'news-list' || $this->view->url_before == '/news' || $view->templ == 'akcii-list' || $this->view->url_before == '/akcii' || $this->view->templ == '_search' || $view->templ == 'sub_category' || $view->templ == 'category' ||  $view->templ == 'brand' ) ? $load->block('preview_akcion_and_news_widget') : '' ?>			<!-- Превью Акций и Новостей  -->
                </div>
            <? endif; ?>

        </div>
        <?=( $view->templ == '_main') ? $load->block('preview_akcion_and_news') : '' ?>				<!-- Превью акции и новости  -->
    </div>

    <div class="footer">

        <?=( $view->templ != 'order' ) ? $load->block('nashi_preimuw') : '' ?>						<!-- Наши преимущества  -->
        <?=( $view->templ != 'order' ) ? '
			<div class="order-callback centering">
				<dl class="order-callback__inner">
					<dt>Сомневаетесь в выборе или Вам нужен совет специалиста?</dt>
					<dd>
						<a href="#feed_back" id="feed_back" class="order-callback__button show-popup open_modal_win">Закажите обратный звонок сейчас</a>
					</dd>
				</dl>	
			</div>	' : '' ?>
        <?=( $view->templ == '_main' ) ? $load->block('authorized_dealers') : ''?>
        <?( $view->templ != 'order' ) ? $load->block('footer_navi') : '' ?>							<!-- Футер навигация  -->
        <?=$load->block('footer')?>																	<!-- Футер  -->
    </div>

</div><!-- Конец врапера -->

<?=( $user->id == 8 || $user->id == 7 || $user->id == 1278 || $user->id == 3386 || $user->id == 3145 || $user->id == 3276 || $user->id == 7895 ) ? $load->block('admin_menu',false,'admin')  : '' ?>

<div id="modal_window" class="global-popup"></div>
<div id="oneclick" class="global-popup"></div>
<div id="bigpic" class="global-popup"></div>

<?=$load->block('comparison')?>

<!-- Yandex.Metrika counter -->
<script type="text/javascript">
    var yaParams = {/*Здесь параметры визита*/};
</script>

<script type="text/javascript">
    (function (d, w, c) {
        (w[c] = w[c] || []).push(function() {
            try {
                w.yaCounter6382003 = new Ya.Metrika({id:6382003,
                    webvisor:true,
                    clickmap:true,
                    trackLinks:true,
                    accurateTrackBounce:true,
                    trackHash:true,params:window.yaParams||{ }});

                if( document.location.pathname == '/order' )
                    w.yaCounter6382003.reachGoal('show_basket');  // Метрика. Цель "Корзина"
            } catch(e) { }
        });

        var n = d.getElementsByTagName("script")[0],
            s = d.createElement("script"),
            f = function () { n.parentNode.insertBefore(s, n); };
        s.type = "text/javascript";
        s.async = true;
        s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js";

        if (w.opera == "[object Opera]") {
            d.addEventListener("DOMContentLoaded", f, false);
        } else { f(); }
    })(document, window, "yandex_metrika_callbacks");
</script>
<noscript><div><img src="//mc.yandex.ru/watch/6382003" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->

<?=$view->printOnLoadJS()?>
</body>
</html>